<template>
  <div class="record-list">
    <div v-for="record in records" :key="record.id" class="record-item">
      <div class="record-header">
        <span class="timestamp">{{ formatDate(record.timestamp) }}</span>
      </div>
      <p class="content">{{ record.content }}</p>
      <div v-if="record.images.length" class="image-grid">
        <img
          v-for="(img, index) in record.images"
          :key="index"
          :src="img"
          class="preview-image"
        />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    records: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    formatDate(isoString) {
      return new Date(isoString).toLocaleString()
    }
  }
}
</script>

<style scoped>
.record-item {
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #eee;
  border-radius: 6px;
}

.timestamp {
  font-size: 0.9em;
  color: #666;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.preview-image {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
}
</style>
